<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        var arr = [1, 4, 5, 6, 2, 3, 2, 5, 1, 8]
        console.log(arr.sort())
            // 冒泡排序法
        function fn(arr1) {
            for (var i = 0; i < arr1.length - 1; i++) {
                for (var j = 0; j < arr1.length - i - 1; j++) {
                    if (arr1[j] > arr1[j + 1]) {
                        var res = arr[j]
                        arr[j] = arr[j + 1]
                        arr[j + 1] = res
                    }
                }
            }
            return arr1;
        }
        console.log(fn(arr))
            // 通过遍历数组去重
        function demo(arr2) {
            for (var i = 0; i < arr2.length; i++) {
                for (var j = i + 1; j < arr2.length - 1; j++) {
                    if (arr2[i] == arr[j]) {
                        arr2.splice(j--, 1)
                    }
                }
            }
            return arr2;
        }
        console.log(demo(arr))
            // for (var i = 0; i < 10; i++) {
            //     var sum = 0
            //     sum += i;
            // }
            // console.log(i)
        var str = '  123456   '
        console.log(str.split(''))
        console.log(str)
        console.log(str.trim())
        console.log(str.split('').join('-'))
        var n = "miao wei ke tang".indexOf("wei", 6)
        var str = "ha ha xi hei";
        console.log(str.replace("ha", "**"))
        var obj = {
            name: '”王大锤”',
            skill: '”逗比”',
            logo: '”日和漫画”'
        }
        for (var value in obj) {
            console.log(obj[value])
        }
    </script>
</body>

</html>